<template>
  <el-card shadow="never" class="aui-card--fill">
    <div class="mod-sys__user">
      <el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
        <!-- <el-form-item label="用户名">
          <el-input v-model="dataForm.userName" :placeholder="$t('user.username')" clearable></el-input>
        </el-form-item> -->
        <el-form-item label="手机号">
          <el-input v-model="dataForm.phone" placeholder="请输入手机号" clearable></el-input>
        </el-form-item>
        <el-form-item label="站点名称">
          <el-input v-model="dataForm.storeName" placeholder="请输入站点名称" clearable></el-input>
        </el-form-item>
        <el-form-item label="试驾车系">
          <el-input v-model="dataForm.userReservationCar" placeholder="请输入试驾品牌/车系" clearable></el-input>
        </el-form-item>
        <el-form-item >
          <el-button @click="getDataList()">{{ $t('query') }}</el-button>
        </el-form-item>
        <el-form-item>
          <el-button  type="primary" @click="addOrUpdateHandle()">增加</el-button>
        </el-form-item> 
        <el-form-item>
          <el-button type="danger" @click="deleteClick('','Batch')">批量删除</el-button>
        </el-form-item>
        <!-- <el-form-item>
          <el-button v-if="$hasPermission('sys:user:export')" type="info" @click="exportHandle()">{{ $t('export') }}</el-button>
        </el-form-item> -->
      </el-form>
      <el-table
        v-loading="dataListLoading"
        :data="dataList"
        border
        @selection-change="dataListSelectionChangeHandle"
        @sort-change="dataListSortChangeHandle"
        style="width: 100%;">
        <el-table-column type="selection" header-align="center" align="center" width="50"></el-table-column>
        <el-table-column type="index" header-align="center" align="center" label="序号" width="50"></el-table-column>
        <!-- <el-table-column prop="userName" label="用户名"   header-align="center" align="center"></el-table-column> -->
        <!-- <el-table-column prop="userId" label="性别" header-align="center" align="center"></el-table-column> -->
        <el-table-column prop="authorizationPhone" label="授权手机号" header-align="center" align="center"></el-table-column>
        <!-- <el-table-column prop="email" label="性别" header-align="center" align="center"></el-table-column> -->
        <!-- reservationPhone -->
        <el-table-column prop="reservationPhone" label="预约手机号"   header-align="center" align="center"></el-table-column>
        <!-- <el-table-column prop="reservationTime" label="预约手机号"   header-align="center" align="center"></el-table-column>
        <el-table-column prop="reservationStatus" label="用户地址"   header-align="center" align="center"></el-table-column> -->
        <el-table-column prop="storeAddress" label="经销商位置"   header-align="center" align="center"></el-table-column>
        <el-table-column prop="storeName" label="站点名称"   header-align="center" align="center"></el-table-column>
        <el-table-column prop="storeUsername" label="联系人名称"   header-align="center" align="center"></el-table-column>
        <el-table-column prop="storePhone" label="联系人电话"   header-align="center" align="center"></el-table-column>
        <el-table-column prop="userReservationCar" label="试驾车系"   header-align="center" align="center"></el-table-column>
        <el-table-column prop="reservationTime" label="预约时间"   header-align="center" align="center"></el-table-column>
        <el-table-column :label="$t('handle')" fixed="right" header-align="center" align="center" width="150">
          <template slot-scope="scope">
            <el-button  type="text" size="small" @click="addOrUpdateHandle(scope.row.id)">编辑</el-button>
            <el-button  type="text" size="small" @click="deleteClick(scope.row.id,'single')">{{ $t('delete') }}</el-button>
          </template>
        </el-table-column>
      </el-table>
      <el-pagination
        :current-page="page"
        :page-sizes="[10, 20, 50, 100]"
        :page-size="limit"
        :total="total"
        layout="total, sizes, prev, pager, next, jumper"
        @size-change="pageSizeChangeHandle"
        @current-change="pageCurrentChangeHandle">
      </el-pagination>
      <!-- 弹窗, 新增 / 修改 -->
      <add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @canCle="canCle" @refreshDataList="getDataList"></add-or-update>
    </div>
  </el-card>
</template>

<script>
import mixinViewModule from '@/mixins/view-module'
import AddOrUpdate from './appoint-add-update'
export default {
  mixins: [mixinViewModule],
  data () {
    return {
      mixinViewModuleOptions: {
        getDataListURL: 'userreservation/page',
        getDataListIsPage: true,
        deleteURL: '/userreservation/delete',
        deleteIsBatch: true,
        exportURL: '/sys/user/export'
      },
      dataForm: {
        userName: '',
        phone: '',
        storeName: '',
        reservationVdsName:""
      }
    }
  },
  components: {
    AddOrUpdate
  },
  methods:{
    
    // deleteClick (id) {
    //   let idChange = String(id)
    //   var formData = new FormData(); // 当前为空
    //   formData.append('ids', [idChange]);
    //   this.$confirm(this.$t('prompt.info', { 'handle': this.$t('delete') }), this.$t('prompt.title'), {
    //     confirmButtonText: this.$t('confirm'),
    //     cancelButtonText: this.$t('cancel'),
    //     type: 'warning'
    //   }).then(() => {
    //     this.$http.post('/userreservation/delete',formData,
    //     {
    //       headers: {
    //         "Content-Type": "multipart/form-data",
    //       },
    //     }
          
    //     ).then(({ data: res }) => {
    //       if (res.code !== 0) {
    //         return this.$message.error(res.msg)
    //       }
    //       this.$message({
    //         message: this.$t('prompt.success'),
    //         type: 'success',
    //         duration: 500,
    //         onClose: () => {
    //           this.query()
    //         }
    //       })
    //     }).catch(() => {})
    //   }).catch(() => {})
    // },
  }
}
</script>
